1. Field of the Invention
The present invention relates to a focus condition detecting device to be used in cameras, video cameras, etc.
2. Related Background Art
The conventional focus condition detecting device for single lens reflex cameras includes a relative displacement detection system, which is described below with reference to FIG. 25. The light rays incoming through a region 101 of a photographing lens 100 pass through a field mask 200, a field lens 300, an aperture 401, and a refocusing lens 501, to form an image on an image sensor array A wherein a number of photoelectric elements to generate the output in proportion to the incoming light intensity are arrayed linearly.
Similarly, the light rays incoming through a region 102 of the photographing lens 100 pass through the field mask 200, a field lens 300, an aperture 402, and a refocusing lens 502 to form an image on an image sensor array B. A pair of images of an object to be photographed, which have been formed in this manner on these image sensor arrays A and B, are spaced away from each other when the photographing lens 100 forms a sharp object image in front of a predetermined focal plane, that is, in the front-focus state. Contrarily, these images are close to each other when a sharp object image is formed behind the predetermined focal plane, that is, in the rear-focus state. When a sharp image of the object is formed on a predetermined focal plane, that is, in the in-focus state, the images on both image sensor arrays A and B coincide with each other.
Accordingly, the electric signal obtained through photoelectric conversion of the pair of object images by the image sensor arrays A and B is processed to determine the relative position of the images, thereby enabling understanding of the focus condition, particularly the defocus amount and direction thereof (hereinafter which are totally referred to as the defocus amount), of the photographing lens 100. A focus condition detection area is where the images on image sensor arrays A and B projected by the refocusing lenses 501 and 502 overlap in the vicinity of the predetermined focal plane.
An operation method to determine the defocus amount is described below.
The image sensor arrays A and B comprise a number of photoelectric elements and output respectively a number of photoelectric conversion output signal trains a1 . . . an and b1 . . . bn (FIGS. 17A and 17B). A correlation operation is performed by shifting data trains relatively by a predetermined number of data L. When the maximum number of shifts is assumed to be Lrng, the L range is from -Lrng to Lrng. Specifically, the correlation C[L] is calculated by the equation (1): ##EQU1##
In equation (1), L is an integer corresponding to the shift amount of the data trains as described above. The initial term k and final term r may be varied depending on the shift amount L.
The defocus amount is determined when the shift amount giving the minimum of the correlations C [L] is multiplied by the constant determined from the pitch width of photoelectric elements of the image sensor arrays and the optical system shown in FIG. 25. However, the correlation C[L] is a discrete value as shown in FIG. 17C and the minimum unit of the detectable defocus amount is restricted by the pitch width of photoelectric elements of both sensor arrays A and B. The minimum value Cex is therefore newly calculated from the discrete correlation C[L] through interpolating operation.
In this operation method, the minimum correlation amount CO and the correlations C1 and C-1 calculated on both sides of the shift amount at which the minimum correlation C0 is calculated are used as shown in FIG. 18. The displacement amount Ls to give the minimum value Cex is calculated by equations (2) and (3): EQU Ls=L+DL/E (2) EQU DL=(C-1-C1 )/2 EQU E=Max{C1-C0, C-1-C0} EQU Cex=C0-.vertline.DL.vertline. (3)
In equation (3), Max {Ca, Cb} means selection of Ca or Cb, whichever is larger. This interpolating operation is referred to as the three-point interpolation. The defocus amount DF is calculated by equation (4) from the displacement amount Ls which gives the minimum value.
In equation (4), Kf is a constant determined by the pitch width of photoelectric elements of the image sensor arrays and optical system shown in FIG. 25. EQU DF=Kf.times.Ls (4)
The defocus amount thus obtained needs to be checked to determine if it is the true defocus amount or if it is due to fluctuations in the correlation caused by noise. The defocus amount is judged to be reliable when it satisfies the conditions expressed by equation (5). EQU E&gt;E1 and Cex/E&lt;G1 (5)
E1 and G1 in equation (5) are certain given values. E (hereinafter referred to as the slope value) is a value dependent on the object contrast, and the contrast becomes higher, with enhanced reliability, when the slope value is larger. On the other hand, Cex/E indicates the degree of coincidence of a pair of data of the image sensor arrays A and B and a Cex/E value nearer to zero indicates higher reliability of the defocus amount. Once judged reliable, the defocus amount DF is used to drive the photographing lens 100. Correlation, interpolation, and judgment on the conditions described above are generally termed as the focus condition detecting operation.
In U.S. Pat. No. 4,561,749, the correlation C[L] is not necessarily calculated for the entire shift range (-Lrng to +Lrng). Instead, the correlation C[L] is calculated by sequentially changing the shift numbers L like 0, 1, -1, 2, -2, . . . , Lrng, -Lrng and the operation is terminated at the time point when the defocus amount that satisfies equation (5) is obtained. In this manner, the calculation of only three correlation amounts of C[-1], C[0], and C[1] is enough and the operation time can be reduced when the object image is formed approximately on the image sensor arrays in the in-focus state.
Note here that an object pattern, if cyclical and iterative as shown in FIGS. 21A and 21B, will cause the iterative pattern in the correlation C [L] as shown in FIG. 21C, making determination of the defocus amount impossible. Therefore, when a plurality of reliable defocus amounts are obtained, the object is judged to have a cyclic pattern.
The image sensor arrays A and B of FIG. 25 are of an electric charge accumulation type such as CCD (Charge Coupled Device), etc. This type of array accumulates, for an appropriate accumulation period, the electric charge generated by each of the photoelectric elements and converts the accumulated electric charge into the voltage to output the data. These arrays can offer adequate data even under bright outdoor conditions or in a dark room by extending the accumulation period when the object is dark and by reducing the period when the object is bright.
In other words, an improperly set accumulation period results in a failure to obtain adequate data, making calculation of the defocus amount impossible. For example, assume here that the image contrast is such that the slope value E can barely satisfy equation (5) for the output higher as a whole as shown in FIG. 20C when the object is a fine one, such as a single black thin line on a white background, then the accumulation period is set shorter. If the output is more or less lower as a whole as shown in FIG. 20D, the contrast becomes lower and the slope value E cannot satisfy equation (5) any more. The result is a complete failure of focus detection.
On the other hand, if the accumulation time is so long that the generated electric charge exceeds the accumulation limit or the operable range, the focus condition detecting operation cannot be made correctly. It is therefore necessary to control the accumulation period if adequate data are to be obtained.
This control of the accumulation period is abbreviated hereinafter as AGC (Auto Gain Control). The AGC methods are roughly classified into two types. The first one consists of determining the accumulation period on the basis of data obtained from the previous accumulation of the electric charge. For example, the accumulation period is set so that the maximum value in the data, which is obtain though the accumulation taken place for the accumulation period, corresponds to the given value. Since the accumulation period is determined by means of the processing operation, this method is referred to as a software-based AGC.
Another method is to set the accumulation period on the basis of the output from a monitor sensor installed in the neighborhood of the image sensor arrays. Since the accumulation period is determined by the hardware, this method is referred to as a hardware-based AGC. Though allowing fine setting of the accumulation period, the software-based AGC requires prior accumulation and is inferior in terms of real-time monitoring. The hardware-based AGC, on the other hand, can perform real-time monitoring of the object luminance, but its monitoring is limited to the average luminance of the image sensor arrays, making fine setting impossible.
The operation described above uses the photoelectric conversion outputs themselves from the arrays for the focus condition detecting operation. To eliminate the harmful component above the Nyquist frequency and the adverse effect of the DC components, namely imbalance in the output between a pair of image sensor arrays, the output from these arrays is filtered to produce a new data, which are then used for the focus condition detecting operation instead of the original data.
For example, when the output signal train of the image sensor is assumed to be D[i], a filtering operation is first made to eliminate the high frequency components to create the following data train H[i]. EQU H[i]=D[i]+2D[i+1]+D[i+2] (6)
In equation (6), the right side may be divided by 4. For this data train H[i], a differential filtering operation expressed by equation (7) is made to remove the DC component, thereby creating the following data train F[i]. EQU F[i]=-H[i]+2H[i+N]-H[i+2N] (7)
In equation (7), a predetermined value may be added to the right side to prevent the F[i] value from becoming a negative value. N is a natural number of around 1 to 10 and the frequency component extracted from such an N value becomes variable. As the N value becomes larger, the lower frequency component is extracted. Therefore, two kinds of N value, such as 3 and 6, may be set up for selection of the appropriate N value according to the object to be photographed. Otherwise, the data train F[i] may be created initially by setting N=3 to be used for correlation of equation (1) and interpolation of equations (2) and (3). If the setting with N=3 proves unsatisfactory for equation (5), then the N value may be reset to N=6 to create the data train F[i] for renewed operation. If the data from which the DC component has been removed to extract the specific frequency components through a filtering operation are used, the focus detection capacity can be improved so as to enable detection of even the finest object such as a single black thin line on a white ground.
This type of focus condition detecting device has often suffered troubles including erroneous determination of the in-focus state in which an image of an object between closer and more distant objects is sharply formed on the image sensor or complete failure of focus detection when a plurality of objects differing in distance form an image on the image sensor arrays. To overcome such problems, a pair of image sensor arrays are respectively divided into a plurality of blocks, thereby dividing the focus condition detecting range into smaller areas, and the focus condition detecting operation is made for each block. Then the displacement amount Ls[i] and defocus amount D[i], which give the minimum value for each block, are determined. Among a plurality of blocks, the block whose defocus amount indicates the nearest point or the one whose contrast is highest is selected and the photographing lens is driven on the basis of the defocus amount of the selected block corresponding to the focus condition of the photographing lens.
Division of the block is made here in such a manner that, for example, a plurality of groups of the initial term k and final term r at the shift amount L=0 are formed for correlation of equation (1). For example, to divide each of light receiving region of a pair of image sensor arrays, each comprising 40 photoelectric elements, i.e. each outputting 40 data, into six blocks, each comprising 6 photoelectric elements, i.e. each outputting 6 data, as shown in FIG. 19A, k=3 and r=8 are set at the shift amount L=0 for block 1 and the correlation C[L] is calculated by equation (1). Then the shift amount Ls giving the minimum value is calculated on the basis of the calculated amount of correlation by equations (2) and (3), from which the defocus amount DF is calculated by equation (4). Similarly, the focus condition detecting operation is made for blocks 2, 3, 4, 5, and 6 respectively by setting k=9 and r=14, k=15 and r=20, k=21 and r=26, k=27 and r=32, and k=33 and r=38 for the shift amount L=0.
As shown in FIG. 19B, a pair of image sensor arrays can be divided into three blocks, each comprising 12 photoelectric elements, i.e. each outputting 12 data, by setting k=3 and r=14 for block 1, k=15 and r=26 for block 2, and k=27 and r=38 for block 3. The blocks thus formed are wider than those shown in FIG. 19A.
The data newly created through the filtering operation as described above can also be divided into a plurality of blocks.
Also available are filtering operations for the extraction of the higher frequency components to form a large number of narrow blocks by decreasing a number of the photoelectric elements consisting of each block and for extraction of lower frequency components to form a small number of wide blocks by increasing a number of the photoelectric elements consisting of each block. Another method available comprises variable block width, wherein the focus condition detecting operation is made initially for the narrow block and, if focus detection is impossible for all blocks, this operation is renewed by widening the blocks.
As there are cases when focus detection becomes impossible if the contrast of the object is located in the boundary of blocks, U.S. Pat. Nos. 5,068,682 and 5,138,357 disclose a method, comprising calculation of the absolute value of the difference between adjacent data for the area in the vicinity of the block boundary and shifting of the boundary position so that the block boundary becomes an area where the absolute difference value becomes minimal.
As explained in the above description concerning the focus condition detecting operation, the object images on the image sensor arrays A and B coincide with each other in the in-focus state, that is, when the sharp image of the object is formed on a predetermined focal plane. In practice, however, the images do not coincide with each other completely in the in-focus state and errors occur because the relative position of the image sensor arrays A and B to the predetermined focal plane, is displaced when the optical system (excluding the photographing lens 100) shown in FIG. 25 is assembled into a camera. This error amount is referred to as hereinafter the assembly error.
Accordingly, the assembly error must be stored in the memory to be compensated for after completion of the operation of equation (2). For example, compensation is made as shown by equation (8) when Z expressed in data pitch is used as a compensation value for the assembly error: EQU Ls=Ls-Z (8)
The compensation value Z differs individually for each camera main body and must therefore be measured for each camera main body to be stored, for example, in EEPROM of the body. Ideally, the assembly error should be uniform within the focus condition detecting range. However, because of aberrations in the focus condition detecting optical system and relative inclination of refocusing lenses 501 and 502 and image sensor arrays A and B during assembly of the optical system shown in FIG. 25, the assembly error does not become uniform and varies depending on the position within the focus condition detecting range, as shown in FIG. 24.
Consequently, the compensation value Z needs to be set for each block when the focus condition detecting range is to be divided into a plurality of blocks.
The compensation value Z[i] must therefore be measured for each block and a plurality of measured compensation values Z[i] are stored in EEPROM. Then, the compensation value Z[i] for each block is reflected in each individual focus condition detecting operation. This compensation calculation is disclosed in U.S. Pat. No. 4,977,311 of the same applicant. The object to be used for measurement of the compensation value Z[i] is, for example, a black-and-white lattice pattern having a sufficiently small cycle for the block width. The compensation value Z[i] thus measured can indicate the assembly error in the center of the block. Note that U.S. Pat. No. 4,977,311 discloses an extremely detailed method of determining the practical compensation value, which comprises storage of the compensation value Z, not in each block, but in each photoelectric element of the image sensor arrays and weighted averaging of the compensation value Z of each photoelectric element according to the contrast distribution of the object pattern.
When a reliable defocus amount can be calculated, the photographing lens 100 is moved by a distance corresponding to the defocus amount by a motor not illustrated in the figure, thereby achieving the in-focus state wherein the sharp object image is formed in the predetermined focal plane. If the defocus amount is large, however, a single lens drive is not enough to achieve the in-focus state due to operational error and the like. It is therefore a general practice to follow a sequence of lens drive, accumulation of the electric charge, and calculation of the defocus amount as shown in the timing chart of FIG. 22A. In this way the second lens drive is made after accumulation of the electric charge for the image sensor arrays and focus condition detecting operation subsequent to the first lens drive.
This sequence for focusing of the lens is referred to as an intermittent servo method. On the other hand, there is a method in which accumulation of electric charge and calculation of the defocus amount are repeated during lens drive, as shown in the timing chart of FIG. 22B, so that lens focusing is performed without stopping the lens drive by changing a target position of the focusing lens derived from the defocus amount. This so-called overlap servo method can result in a shorter period required to reach the in-focus state than the intermittent servo method.
Since the overlap servo method performs accumulation of electric charge in the image sensor arrays while the lens is driven, the object image on the image sensor arrays may be blurred when the object is dark and the accumulation period becomes long. Degradation of the calculation accuracy and unstable lens drive may occur, and this method may require a longer time for accomplishment of in-focus state than the intermittent servo method. To overcome this problem, U.S. Pat. No. 4,922,279 proposed a changeover to the overlap servo method when the object is bright and to the intermittent servo method when the object is dark.
Failure to obtain a reliable defocus amount may be due to extreme displacement of the lens from the position at which the in-focus state is obtained. In the prior art, the so-called scanning operation is employed, so that the reliable defocus amount can be obtained though repetition of accumulation of electric charge and calculation of defocus amount while driving the lens in a predetermined direction. For example, the lens is first driven in a direction toward its nearer end, on reaching the nearer end, the drive direction is changed to drive the lens toward the more-distant end. At the most distant end, the lens drive is stopped to terminate the scanning operation. Generally, this scanning operation is made only when a reliable defocus amount cannot be obtained by the initial focus condition detecting operation.
For example, if the moving object goes out of the focus condition detecting range during panning of an object, stopping the lens drive allows a photographer to reach the in-focus state within a short time by catching the object again within the focus condition detecting range. On the other hand, scanning always involves the driving of the lens in a predetermined direction, which in turn requires a long time to reach the in-focus state again.
When the object is too dark to obtain data for adequate output even by setting the accumulation period to the longest possible, the auxiliary light with the contrast pattern as shown in FIG. 23 is irradiated, so that the focus condition detecting operation can be carried out with such a contrast pattern to obtain the adequate output for dark object.
U.S. Pat. No. 5,068,682 discloses a method in which, in order to prevent detection of focus condition from being disabled because of the contrast of an object located at a boundary between blocks, the absolute value of the difference between adjacent data in the neighborhood of the block boundary is calculated and the boundary position is shifted so that the block boundary is where the absolute value of the difference is minimal. This method is extremely useful with the data whose DC component has not been removed, but not applicable to the case where data with the DC component having been completely removed by filtering is used. This problem will be described with reference to FIGS. 29A, 29B and 29C.
FIG. 29A shows the output of the image sensor array when an object has a fine pattern, for example, a single thin black line drawn on a white background. Filtering as expressed by equations (6) and (7) is made with this output to produce the data completely devoid of the DC component as shown in FIG. 29B. FIG. 29C shows an enlarged view of FIG. 29B. Referring to FIG. 29C, it must be determined between which data among v1-v9 should the block boundary be set. Since the block boundary must be set so that the portion with contrast belongs to one of two blocks as much as possible, the block boundary must be set between v1 and v2. If the conventional practice of setting the block boundary at a portion where the absolute value of the difference between two adjacent data becomes minimal, .vertline.F[v5]-F[v6].vertline. also becomes the minimum, with the boundary being set between v5 and v6 which is equivalent to the center portion of the contrast. This in turn means that the pattern whose contrast is originally low is divided into two portions to allow operations to detect the focus condition. As a result, highly accurate detection may not be obtained or even the detection itself may be disabled.